define(['app'], function(app) {
	'use strict';

	// 实例化方法
	var factory = function(Http) {
	    /**
         * 一键切换数据获取方式
         * @param {Object} result
         */
        function get_data_getlist(result){
            if(HTTP_ISLOGIC){
                result='{"success": true,"msg": "","result": {'+
        '"name": "促销","total_attention_num": 100,"total_apply_num": 100,'+
        '"total_agree_num": 100,"total_pay_num": 100,"total_answer_num": 100,'+
        '"attention_num": ['+
            '{"region_id": "001","region_name": "江苏","number": 100},'+
            '{"region_id": "002","region_name": "浙江","number": 100}],'+
        '"apply_num": ['+
            '{"region_id": "001","region_name": "江苏","number": 100},'+
            '{"region_id": "002","region_name": "浙江","number": 100}],'+
        '"agree_num": ['+
            '{"region_id": "001","region_name": "江苏","number": 100},'+
            '{"region_id": "002","region_name": "浙江","number": 100}],'+
        '"pay_num": ['+
            '{"region_id": "001","region_name": "江苏","number": 100},'+
            '{"region_id": "002","region_name": "浙江","number": 100}],'+
        '"answer_num": ['+
            '{"region_id": "001","region_name": "江苏","number": 100},'+
            '{"region_id": "002","region_name": "浙江","number": 100}]},'+
         '"session": "7311da98bd0f18eb15a96bcb263f4153"}';
                return JSON.parse(result);
            }else{
                return result;
            }
        }

			return {
			    //获取促销统计
			    getlist: function(act_id,act_type,callback){
			        Http.post({
			            method:'marketing.newgoods.statistics',
                        session:'',
                        act_id:act_id,
                        act_type:act_type
			        },
			        function(result){
			            //请求成功
			            if(callback){
			                callback(get_data_getlist(result).result);
			            }
			        },
			        function(e){
			            //请求异常
			        },function(){
			            //请求完成，一般不做什么事情
			        });
			    },
		
		};
	}

	factory.$inject = [ 'Http' ];
	return app.registerService("Statistics_test", factory);
});